
import 'package:Flutter_Demo/ui/pages/detail/detail.dart';
import 'package:Flutter_Demo/ui/pages/filter/fliter.dart';
import 'package:Flutter_Demo/ui/pages/main/main.dart';
import 'package:Flutter_Demo/ui/pages/meal/meal.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';


/*
// 路由跳转
Future<T> push<T extends Object>(Route<T> route)

// 路由跳转
Future<T> pushName<T extends Object>(

  String routeName, {
    Object arguments,
  }
)

// 路由返回： 可以传入一个参数
bool pop<T extends Object>([T reslut])
 */



class MYRouter {

  static final String initialRoute = MYMainScreen.routeName;

  static final Map<String, WidgetBuilder> routes = {
    MYMainScreen.routeName: (ctx) => MYMainScreen(),
    MYMealScreen.routeName: (ctx) => MYMealScreen(),
    MYDetailScreen.routeName: (ctx) => MYDetailScreen()

  };

  // 自己扩展
  static final RouteFactory generateRoute = (setting) {
    if(setting.name == MYFliterScreen.routeName) {
      return MaterialPageRoute(
        builder: (ctx) {
          return MYFliterScreen();
        },
        fullscreenDialog: true
      );
    }


    return null;
  };

  static final RouteFactory unknownRoute = (setting) {
    return null;
  };




}